package com.lz.message.redis;

import java.util.concurrent.CountDownLatch;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.listener.PatternTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;


/**
 * 实现延迟队列思路：
 * 	1：将消息保存到一个有序集合，Score为延迟执行的时间
 * 	2：一个线程不断从该有序集合中查询score为0至当前时间范围的数据，如果存在讲数据压入一个list中，同时删除有序集合中这部分数据
 * 	3：消费者坚挺消息对列，取数据消费
 * @author luozhen
 *
 */
@SpringBootApplication
public class Application {

	private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);


	public static void main(String[] args) throws InterruptedException {
		SpringApplication.run(Application.class, args);
	}
}
